//引用公共函数文件
var user_other_fun = require("../../utils/user_other.js");
var user_view_fun = require("../../utils/user_view.js");
var user_love_fun = require("../../utils/user_love.js");
var user_collect_fun = require("../../utils/user_collect.js");
//获取应用实例
var app = getApp()
Page({
  data: {
    userInfo: {},
    vip: "display:none;",
    config: {
      showLove: 1,
      showCollect: 1,
      openid: null,
    },
    headimgurl: "",
    //上传图片链接数组
    big_image_array: [{}],
    small_image_array: [{}],
    photo_css: "display:none;",
    slide_tip_css1: "display:none;position:absolute;left:100rpx;top:60rpx;width:25rpx;height:33rpx;",
    slide_tip_css2: "display:none;position:absolute;right:82rpx;top:60rpx;width:25rpx;height:33rpx;",
  },
  onLoad: function (options) {
    var that = this
    if (options.openid != "") {
      //定义全局分享者的openid
      app.globalData.shareopenid = options.openid;
      that.setData({
        'config.openid': options.openid,
      })
    }
    wx.request({
      url: app.globalData.API_Base_URL + "/gettype/index/getType",
      data: "",
      success: function (res) {
        app.globalData.typeArray = res.data;
      }
    })
  },
  show_head_image: function (e) {
    var that = this
    add_form_id(e.detail.formId)
    wx.previewImage({
      current: that.headimgurl,
      urls: [that.headimgurl]
    })
  },
  onShow: function () {
    var that = this;
    //调用应用实例的方法获取全局数据
    app.getUserInfo(function (userInfo) {
      //获取他人的数据
      if (that.data.config.openid != "") {
        user_other_fun.getRemoteOtherUserInfo(that.data.config.openid, that.dataLoadCallback)
      }
    })
    wx.request({
      url: app.globalData.API_Base_URL + "/gettype/index/getType",
      data: "",
      success: function (res) {
        app.globalData.typeArray = res.data;
      }
    })
  },
  //复制
  copy_wechat: function () {
    var that = this
    wx.setClipboardData({
      data: that.data.userInfo.email,
    })
    wx.showToast({
      title: '复制成功',
      icon: 'success',
      duration: 300,
      mask: true,
    });
  },
  copy_wechat2: function () {
      var that = this
      wx.setClipboardData({
          data: that.data.userInfo.wechat,
      })
      wx.showToast({
          title: '复制成功',
          icon: 'success',
          duration: 300,
          mask: true,
      });
  },
  //获取大图片
  getBigImage: function () {
    var that = this
    var openid = that.data.config.openid
    wx.request({
      url: app.globalData.API_Base_URL + "/user_get_image.php?openid=" + openid,
      success: function (res) {
        var temp = res.data;
        if (temp.length == 1) {
          var tempArray = [{}];
          tempArray = [
            {
              "key": temp[0],
              "value": app.globalData.API_Base_URL + "/public/upload_photos/" + openid + "__" + temp[0] + ".png"
            }]
          that.setData({
            big_image_array: tempArray,
            photo_css: "",
            slide_tip_css1: "display:none;",
            slide_tip_css2: "display:none;",
          })
        } else if (temp.length == 2) {
          var tempArray = [{}];
          tempArray = [
            {
              "key": temp[0],
              "value": app.globalData.API_Base_URL + "/public/upload_photos/" + openid + "__" + temp[0] + ".png"
            },
            {
              "key": temp[1],
              "value": app.globalData.API_Base_URL + "/public/upload_photos/" + openid + "__" + temp[1] + ".png"
            }]
          that.setData({
            big_image_array: tempArray,
            photo_css: "",
            slide_tip_css1: "display:none;",
            slide_tip_css2: "display:none;",
          })
        } else if (temp.length == 3) {
          var tempArray = [{}];
          tempArray = [
            {
              "key": temp[0],
              "value": app.globalData.API_Base_URL + "/public/upload_photos/" + openid + "__" + temp[0] + ".png"
            },
            {
              "key": temp[1],
              "value": app.globalData.API_Base_URL + "/public/upload_photos/" + openid + "__" + temp[1] + ".png"
            },
            {
              "key": temp[2],
              "value": app.globalData.API_Base_URL + "/public/upload_photos/" + openid + "__" + temp[2] + ".png"
            }]
          that.setData({
            big_image_array: tempArray,
            photo_css: "",
            slide_tip_css1: "display:none;",
            slide_tip_css2: "display:none;",
          })
        } else if (temp.length == 4) {
          var tempArray = [{}];
          tempArray = [
            {
              "key": temp[0],
              "value": app.globalData.API_Base_URL + "/public/upload_photos/" + openid + "__" + temp[0] + ".png"
            },
            {
              "key": temp[1],
              "value": app.globalData.API_Base_URL + "/public/upload_photos/" + openid + "__" + temp[1] + ".png"
            },
            {
              "key": temp[2],
              "value": app.globalData.API_Base_URL + "/public/upload_photos/" + openid + "__" + temp[2] + ".png"
            },
            {
              "key": temp[3],
              "value": app.globalData.API_Base_URL + "/public/upload_photos/" + openid + "__" + temp[3] + ".png"
            }]
          that.setData({
            big_image_array: tempArray,
            photo_css: "",
            slide_tip_css1: "position:absolute;left:100rpx;top:60rpx;width:25rpx;height:33rpx;",
            slide_tip_css2: "position:absolute;right:82rpx;top:60rpx;width:25rpx;height:33rpx;",
          })
        } else if (temp.length == 5) {
          var tempArray = [{}];
          tempArray = [
            {
              "key": temp[0],
              "value": app.globalData.API_Base_URL + "/public/upload_photos/" + openid + "__" + temp[0] + ".png"
            },
            {
              "key": temp[1],
              "value": app.globalData.API_Base_URL + "/public/upload_photos/" + openid + "__" + temp[1] + ".png"
            },
            {
              "key": temp[2],
              "value": app.globalData.API_Base_URL + "/public/upload_photos/" + openid + "__" + temp[2] + ".png"
            },
            {
              "key": temp[3],
              "value": app.globalData.API_Base_URL + "/public/upload_photos/" + openid + "__" + temp[3] + ".png"
            },
            {
              "key": temp[4],
              "value": app.globalData.API_Base_URL + "/public/upload_photos/" + openid + "__" + temp[4] + ".png"
            }]
          that.setData({
            big_image_array: tempArray,
            photo_css: "",
            slide_tip_css1: "position:absolute;left:100rpx;top:60rpx;width:25rpx;height:33rpx;",
            slide_tip_css2: "position:absolute;right:82rpx;top:60rpx;width:25rpx;height:33rpx;",
          })
        } else if (temp.length == 6) {
          var tempArray = [{}];
          tempArray = [
            {
              "key": temp[0],
              "value": app.globalData.API_Base_URL + "/public/upload_photos/" + openid + "__" + temp[0] + ".png"
            },
            {
              "key": temp[1],
              "value": app.globalData.API_Base_URL + "/public/upload_photos/" + openid + "__" + temp[1] + ".png"
            },
            {
              "key": temp[2],
              "value": app.globalData.API_Base_URL + "/public/upload_photos/" + openid + "__" + temp[2] + ".png"
            },
            {
              "key": temp[3],
              "value": app.globalData.API_Base_URL + "/public/upload_photos/" + openid + "__" + temp[3] + ".png"
            },
            {
              "key": temp[4],
              "value": app.globalData.API_Base_URL + "/public/upload_photos/" + openid + "__" + temp[4] + ".png"
            },
            {
              "key": temp[5],
              "value": app.globalData.API_Base_URL + "/public/upload_photos/" + openid + "__" + temp[5] + ".png"
            }]
          that.setData({
            big_image_array: tempArray,
            photo_css: "",
            slide_tip_css1: "position:absolute;left:100rpx;top:60rpx;width:25rpx;height:33rpx;",
            slide_tip_css2: "position:absolute;right:82rpx;top:60rpx;width:25rpx;height:33rpx;",
          })
        } else {
          that.setData({
            photo_css: "display:none",
            slide_tip_css: "display:none;",
          })
        }
      }
    })
  },
  //获取小图片
  getSmallImage: function () {
    var that = this
    var openid = that.data.config.openid
    wx.request({
      url: app.globalData.API_Base_URL + "/user_get_image.php?openid=" + openid + "&small=1",
      success: function (res) {
        var temp = res.data;
        if (temp.length == 1) {
          var tempArray = [{}];
          tempArray = [{
            "key": temp[0],
            "value": app.globalData.API_Base_URL + "/public/upload_photos/" + openid + "__" + temp[0] + "__s.png"
          }]
          that.setData({
            small_image_array: tempArray,
            photo_css: "",
            slide_tip_css1: "display:none;",
            slide_tip_css2: "display:none;",
          })
        } else if (temp.length == 2) {
          var tempArray = [{}];
          tempArray = [
            {
              "key": temp[0],
              "value": app.globalData.API_Base_URL + "/public/upload_photos/" + openid + "__" + temp[0] + "__s.png"
            },
            {
              "key": temp[1],
              "value": app.globalData.API_Base_URL + "/public/upload_photos/" + openid + "__" + temp[1] + "__s.png"
            }]
          that.setData({
            small_image_array: tempArray,
            photo_css: "",
            slide_tip_css1: "display:none;",
            slide_tip_css2: "display:none;",
          })
        } else if (temp.length == 3) {
          var tempArray = [{}];
          tempArray = [{
            "key": temp[0],
            "value": app.globalData.API_Base_URL + "/public/upload_photos/" + openid + "__" + temp[0] + "__s.png"
          },
          {
            "key": temp[1],
            "value": app.globalData.API_Base_URL + "/public/upload_photos/" + openid + "__" + temp[1] + "__s.png"
          },
          {
            "key": temp[2],
            "value": app.globalData.API_Base_URL + "/public/upload_photos/" + openid + "__" + temp[2] + "__s.png"
          }]
          that.setData({
            small_image_array: tempArray,
            photo_css: "",
            slide_tip_css1: "display:none;",
            slide_tip_css2: "display:none;",
          })
        } else if (temp.length == 4) {
          var tempArray = [{}];
          tempArray = [{
            "key": temp[0],
            "value": app.globalData.API_Base_URL + "/public/upload_photos/" + openid + "__" + temp[0] + "__s.png"
          },
          {
            "key": temp[1],
            "value": app.globalData.API_Base_URL + "/public/upload_photos/" + openid + "__" + temp[1] + "__s.png"
          },
          {
            "key": temp[2],
            "value": app.globalData.API_Base_URL + "/public/upload_photos/" + openid + "__" + temp[2] + "__s.png"
          },
          {
            "key": temp[3],
            "value": app.globalData.API_Base_URL + "/public/upload_photos/" + openid + "__" + temp[3] + "__s.png"
          }]
          that.setData({
            small_image_array: tempArray,
            photo_css: "",
            slide_tip_css1: "position:absolute;left:100rpx;top:60rpx;width:25rpx;height:33rpx;",
            slide_tip_css2: "position:absolute;right:82rpx;top:60rpx;width:25rpx;height:33rpx;",
          })
        } else if (temp.length == 5) {
          var tempArray = [{}];
          tempArray = [{
            "key": temp[0],
            "value": app.globalData.API_Base_URL + "/public/upload_photos/" + openid + "__" + temp[0] + "__s.png"
          },
          {
            "key": temp[1],
            "value": app.globalData.API_Base_URL + "/public/upload_photos/" + openid + "__" + temp[1] + "__s.png"
          },
          {
            "key": temp[2],
            "value": app.globalData.API_Base_URL + "/public/upload_photos/" + openid + "__" + temp[2] + "__s.png"
          },
          {
            "key": temp[3],
            "value": app.globalData.API_Base_URL + "/public/upload_photos/" + openid + "__" + temp[3] + "__s.png"
          },
          {
            "key": temp[4],
            "value": app.globalData.API_Base_URL + "/public/upload_photos/" + openid + "__" + temp[4] + "__s.png"
          }]
          that.setData({
            small_image_array: tempArray,
            photo_css: "",
            slide_tip_css1: "position:absolute;left:100rpx;top:60rpx;width:25rpx;height:33rpx;",
            slide_tip_css2: "position:absolute;right:82rpx;top:60rpx;width:25rpx;height:33rpx;",
          })
        } else if (temp.length == 6) {
          var tempArray = [{}];
          tempArray = [{
            "key": temp[0],
            "value": app.globalData.API_Base_URL + "/public/upload_photos/" + openid + "__" + temp[0] + "__s.png"
          },
          {
            "key": temp[1],
            "value": app.globalData.API_Base_URL + "/public/upload_photos/" + openid + "__" + temp[1] + "__s.png"
          },
          {
            "key": temp[2],
            "value": app.globalData.API_Base_URL + "/public/upload_photos/" + openid + "__" + temp[2] + "__s.png"
          },
          {
            "key": temp[3],
            "value": app.globalData.API_Base_URL + "/public/upload_photos/" + openid + "__" + temp[3] + "__s.png"
          },
          {
            "key": temp[4],
            "value": app.globalData.API_Base_URL + "/public/upload_photos/" + openid + "__" + temp[4] + "__s.png"
          },
          {
            "key": temp[5],
            "value": app.globalData.API_Base_URL + "/public/upload_photos/" + openid + "__" + temp[5] + "__s.png"
          }]
          that.setData({
            small_image_array: tempArray,
            photo_css: "",
            slide_tip_css1: "position:absolute;left:100rpx;top:60rpx;width:25rpx;height:33rpx;",
            slide_tip_css2: "position:absolute;right:82rpx;top:60rpx;width:25rpx;height:33rpx;",
          })
        } else {
          that.setData({
            photo_css: "display:none",
            slide_tip_css: "display:none;",
          })
        }
      }
    })
  },
  //获取旧版大图片
  getBigImage1: function () {
    var that = this
    var openid = that.data.config.openid
    wx.request({
      url: "https://mp.87apk.com" + "/user_get_image.php?openid=" + openid,
      success: function (res) {
        var temp = res.data;
        if (temp.length == 1) {
          var tempArray = [{}];
          tempArray = [
            {
              "key": temp[0],
              "value": "https://mp.87apk.com" + "/public/upload_photos/" + openid + "__" + temp[0] + ".png"
            }]
          that.setData({
            big_image_array: tempArray,
            photo_css: "",
            slide_tip_css1: "display:none;",
            slide_tip_css2: "display:none;",
          })
        } else if (temp.length == 2) {
          var tempArray = [{}];
          tempArray = [
            {
              "key": temp[0],
              "value": "https://mp.87apk.com" + "/public/upload_photos/" + openid + "__" + temp[0] + ".png"
            },
            {
              "key": temp[1],
              "value": "https://mp.87apk.com" + "/public/upload_photos/" + openid + "__" + temp[1] + ".png"
            }]
          that.setData({
            big_image_array: tempArray,
            photo_css: "",
            slide_tip_css1: "display:none;",
            slide_tip_css2: "display:none;",
          })
        } else if (temp.length == 3) {
          var tempArray = [{}];
          tempArray = [
            {
              "key": temp[0],
              "value": "https://mp.87apk.com" + "/public/upload_photos/" + openid + "__" + temp[0] + ".png"
            },
            {
              "key": temp[1],
              "value": "https://mp.87apk.com" + "/public/upload_photos/" + openid + "__" + temp[1] + ".png"
            },
            {
              "key": temp[2],
              "value": "https://mp.87apk.com" + "/public/upload_photos/" + openid + "__" + temp[2] + ".png"
            }]
          that.setData({
            big_image_array: tempArray,
            photo_css: "",
            slide_tip_css1: "display:none;",
            slide_tip_css2: "display:none;",
          })
        } else if (temp.length == 4) {
          var tempArray = [{}];
          tempArray = [
            {
              "key": temp[0],
              "value": "https://mp.87apk.com" + "/public/upload_photos/" + openid + "__" + temp[0] + ".png"
            },
            {
              "key": temp[1],
              "value": "https://mp.87apk.com" + "/public/upload_photos/" + openid + "__" + temp[1] + ".png"
            },
            {
              "key": temp[2],
              "value": "https://mp.87apk.com" + "/public/upload_photos/" + openid + "__" + temp[2] + ".png"
            },
            {
              "key": temp[3],
              "value": "https://mp.87apk.com" + "/public/upload_photos/" + openid + "__" + temp[3] + ".png"
            }]
          that.setData({
            big_image_array: tempArray,
            photo_css: "",
            slide_tip_css1: "position:absolute;left:100rpx;top:60rpx;width:25rpx;height:33rpx;",
            slide_tip_css2: "position:absolute;right:82rpx;top:60rpx;width:25rpx;height:33rpx;",
          })
        } else if (temp.length == 5) {
          var tempArray = [{}];
          tempArray = [
            {
              "key": temp[0],
              "value": "https://mp.87apk.com" + "/public/upload_photos/" + openid + "__" + temp[0] + ".png"
            },
            {
              "key": temp[1],
              "value": "https://mp.87apk.com" + "/public/upload_photos/" + openid + "__" + temp[1] + ".png"
            },
            {
              "key": temp[2],
              "value": "https://mp.87apk.com" + "/public/upload_photos/" + openid + "__" + temp[2] + ".png"
            },
            {
              "key": temp[3],
              "value": "https://mp.87apk.com" + "/public/upload_photos/" + openid + "__" + temp[3] + ".png"
            },
            {
              "key": temp[4],
              "value": "https://mp.87apk.com" + "/public/upload_photos/" + openid + "__" + temp[4] + ".png"
            }]
          that.setData({
            big_image_array: tempArray,
            photo_css: "",
            slide_tip_css1: "position:absolute;left:100rpx;top:60rpx;width:25rpx;height:33rpx;",
            slide_tip_css2: "position:absolute;right:82rpx;top:60rpx;width:25rpx;height:33rpx;",
          })
        } else if (temp.length == 6) {
          var tempArray = [{}];
          tempArray = [
            {
              "key": temp[0],
              "value": "https://mp.87apk.com" + "/public/upload_photos/" + openid + "__" + temp[0] + ".png"
            },
            {
              "key": temp[1],
              "value": "https://mp.87apk.com" + "/public/upload_photos/" + openid + "__" + temp[1] + ".png"
            },
            {
              "key": temp[2],
              "value": "https://mp.87apk.com" + "/public/upload_photos/" + openid + "__" + temp[2] + ".png"
            },
            {
              "key": temp[3],
              "value": "https://mp.87apk.com" + "/public/upload_photos/" + openid + "__" + temp[3] + ".png"
            },
            {
              "key": temp[4],
              "value": "https://mp.87apk.com" + "/public/upload_photos/" + openid + "__" + temp[4] + ".png"
            },
            {
              "key": temp[5],
              "value": "https://mp.87apk.com" + "/public/upload_photos/" + openid + "__" + temp[5] + ".png"
            }]
          that.setData({
            big_image_array: tempArray,
            photo_css: "",
            slide_tip_css1: "position:absolute;left:100rpx;top:60rpx;width:25rpx;height:33rpx;",
            slide_tip_css2: "position:absolute;right:82rpx;top:60rpx;width:25rpx;height:33rpx;",
          })
        } else {
          that.setData({
            photo_css: "display:none",
            slide_tip_css: "display:none;",
          })
        }
      }
    })
  },
  //获取旧版小图片
  getSmallImage1: function () {
    var that = this
    var openid = that.data.config.openid
    wx.request({
      url: "https://mp.87apk.com" + "/user_get_image.php?openid=" + openid + "&small=1",
      success: function (res) {
        var temp = res.data;
        if (temp.length == 1) {
          var tempArray = [{}];
          tempArray = [{
            "key": temp[0],
            "value": "https://mp.87apk.com" + "/public/upload_photos/" + openid + "__" + temp[0] + "__s.png"
          }]
          that.setData({
            small_image_array: tempArray,
            photo_css: "",
            slide_tip_css1: "display:none;",
            slide_tip_css2: "display:none;",
          })
        } else if (temp.length == 2) {
          var tempArray = [{}];
          tempArray = [
            {
              "key": temp[0],
              "value": "https://mp.87apk.com" + "/public/upload_photos/" + openid + "__" + temp[0] + "__s.png"
            },
            {
              "key": temp[1],
              "value": "https://mp.87apk.com" + "/public/upload_photos/" + openid + "__" + temp[1] + "__s.png"
            }]
          that.setData({
            small_image_array: tempArray,
            photo_css: "",
            slide_tip_css1: "display:none;",
            slide_tip_css2: "display:none;",
          })
        } else if (temp.length == 3) {
          var tempArray = [{}];
          tempArray = [{
            "key": temp[0],
            "value": "https://mp.87apk.com" + "/public/upload_photos/" + openid + "__" + temp[0] + "__s.png"
          },
          {
            "key": temp[1],
            "value": "https://mp.87apk.com" + "/public/upload_photos/" + openid + "__" + temp[1] + "__s.png"
          },
          {
            "key": temp[2],
            "value": "https://mp.87apk.com" + "/public/upload_photos/" + openid + "__" + temp[2] + "__s.png"
          }]
          that.setData({
            small_image_array: tempArray,
            photo_css: "",
            slide_tip_css1: "display:none;",
            slide_tip_css2: "display:none;",
          })
        } else if (temp.length == 4) {
          var tempArray = [{}];
          tempArray = [{
            "key": temp[0],
            "value": "https://mp.87apk.com" + "/public/upload_photos/" + openid + "__" + temp[0] + "__s.png"
          },
          {
            "key": temp[1],
            "value": "https://mp.87apk.com" + "/public/upload_photos/" + openid + "__" + temp[1] + "__s.png"
          },
          {
            "key": temp[2],
            "value": "https://mp.87apk.com" + "/public/upload_photos/" + openid + "__" + temp[2] + "__s.png"
          },
          {
            "key": temp[3],
            "value": "https://mp.87apk.com" + "/public/upload_photos/" + openid + "__" + temp[3] + "__s.png"
          }]
          that.setData({
            small_image_array: tempArray,
            photo_css: "",
            slide_tip_css1: "position:absolute;left:100rpx;top:60rpx;width:25rpx;height:33rpx;",
            slide_tip_css2: "position:absolute;right:82rpx;top:60rpx;width:25rpx;height:33rpx;",
          })
        } else if (temp.length == 5) {
          var tempArray = [{}];
          tempArray = [{
            "key": temp[0],
            "value": "https://mp.87apk.com" + "/public/upload_photos/" + openid + "__" + temp[0] + "__s.png"
          },
          {
            "key": temp[1],
            "value": "https://mp.87apk.com" + "/public/upload_photos/" + openid + "__" + temp[1] + "__s.png"
          },
          {
            "key": temp[2],
            "value": "https://mp.87apk.com" + "/public/upload_photos/" + openid + "__" + temp[2] + "__s.png"
          },
          {
            "key": temp[3],
            "value": "https://mp.87apk.com" + "/public/upload_photos/" + openid + "__" + temp[3] + "__s.png"
          },
          {
            "key": temp[4],
            "value": "https://mp.87apk.com" + "/public/upload_photos/" + openid + "__" + temp[4] + "__s.png"
          }]
          that.setData({
            small_image_array: tempArray,
            photo_css: "",
            slide_tip_css1: "position:absolute;left:100rpx;top:60rpx;width:25rpx;height:33rpx;",
            slide_tip_css2: "position:absolute;right:82rpx;top:60rpx;width:25rpx;height:33rpx;",
          })
        } else if (temp.length == 6) {
          var tempArray = [{}];
          tempArray = [{
            "key": temp[0],
            "value": "https://mp.87apk.com" + "/public/upload_photos/" + openid + "__" + temp[0] + "__s.png"
          },
          {
            "key": temp[1],
            "value": "https://mp.87apk.com" + "/public/upload_photos/" + openid + "__" + temp[1] + "__s.png"
          },
          {
            "key": temp[2],
            "value": "https://mp.87apk.com" + "/public/upload_photos/" + openid + "__" + temp[2] + "__s.png"
          },
          {
            "key": temp[3],
            "value": "https://mp.87apk.com" + "/public/upload_photos/" + openid + "__" + temp[3] + "__s.png"
          },
          {
            "key": temp[4],
            "value": "https://mp.87apk.com" + "/public/upload_photos/" + openid + "__" + temp[4] + "__s.png"
          },
          {
            "key": temp[5],
            "value": "https://mp.87apk.com" + "/public/upload_photos/" + openid + "__" + temp[5] + "__s.png"
          }]
          that.setData({
            small_image_array: tempArray,
            photo_css: "",
            slide_tip_css1: "position:absolute;left:100rpx;top:60rpx;width:25rpx;height:33rpx;",
            slide_tip_css2: "position:absolute;right:82rpx;top:60rpx;width:25rpx;height:33rpx;",
          })
        } else {
          that.setData({
            photo_css: "display:none",
            slide_tip_css: "display:none;",
          })
        }
      }
    })
  },
  //图片预览
  showPhoto: function (e) {
    var that = this
    var openid = that.data.config.openid
    var array = [];
    for (var i = 0; i < this.data.big_image_array.length; i++) {
      array[i] = this.data.big_image_array[i].value;
    }
    if (that.data.userInfo.new_or_old == 0) {
      wx.previewImage({
        current: "https://mp.87apk.com" + "/public/upload_photos/" + openid + "__" + e.target.id + ".png",
        urls: array
      })
    } else {
      wx.previewImage({
        current: app.globalData.API_Base_URL + "/public/upload_photos/" + openid + "__" + e.target.id + ".png",
        urls: array
      })
    }
  },
  //显示vip
  showVip: function () {
    var that = this;
    wx.request({
      url: app.globalData.API_Base_URL + "/user_vip.php?openid=" + that.data.config.openid,
      success(res) {
        if (res.data.vip == 1) {
          that.setData({
            vip: "",
          })
        } else {
          that.setData({
            vip: "display:none;",
          })
        }
      }
    })
  },
  dataLoadCallback: function (res) {
    var that = this;
    var other_user = res.data.data;
    if (other_user.wechat == null || other_user.wechat == "undefined" || other_user.wechat == "" || other_user.wechat == "null") {
        other_user.wechat = "";
    }
    this.setData({
      userInfo: other_user,
      "config.showLove": other_user.can_love,
      "config.showCollect": other_user.can_collect,
    }),
      wx.setNavigationBarTitle({
        title: other_user.nickname + " 的名片"
      })
    this.headimgurl = other_user.headimgurl
    that.showVip();
    if (that.data.userInfo.new_or_old == 0) {
      that.getSmallImage1()
      that.getBigImage1()
    } else {
      that.getSmallImage()
      that.getBigImage()
    }
  },
  //百万曝光
  gotofind: function (e) {
    add_form_id(e.detail.formId)
    wx.switchTab({
      url: "/pages/find2/find2"
    })
  },
  //打开我的名片
  openMyCard: function () {
    wx.switchTab({
      url: '/page/index/index',
    })
  },
  toEdit: function () {
    wx.redirectTo({
      url: '../edit/edit',
    })
  },
  //打电话
  callPhone: function (event) {
    var phone = event.target.dataset.phone;
    if (phone != "") {
      wx.makePhoneCall({
        phoneNumber: phone,
        success: function (res) {
          // success
        }
      })
    }
  },
  //喜欢
  loveCard: function (event) {
    var openid = event.target.dataset.openid;
    user_love_fun.updateUserLoveAdd(openid, this.saveCallBack);
    wx.showToast({
      title: '点赞成功',
      mask: true,
    })
  },
  //取消喜欢
  cancelLoveCard: function (event) {
    var openid = event.target.dataset.openid;
    user_love_fun.updateUserLoveDrop(openid, this.saveCallBack);
    wx.showToast({
      title: '取消成功',
      mask: true,
    })
  },
  //收藏名片
  collectCard: function (e) {
    add_form_id(e.detail.formId)
    var openid = e.target.dataset.openid;
    if (openid == "" || openid == null) {
      wx.showToast({
        title: '请稍后再试',
        image: "../../image/cancel.png",
        mask: true,
      })
    } else if (openid != app.globalData.openid) {
      this.sendCollectMessage()
      user_collect_fun.updateUserCollectAdd(openid, this.saveCallBack);
      wx.showToast({
        title: '收藏成功',
        mask: true,
      })
    } else {
      wx.showToast({
        title: '自己不需要收藏',
        image: "../../image/cancel.png",
        mask: true,
      })
    }
  },
  //发送收藏信息
  sendCollectMessage() {
    var that = this
    var openid = that.data.userInfo.openid
    wx.request({
      url: app.globalData.API_Base_URL + "/formid/index/getFormId?openid=" + openid,
      success: function (res) {
        console.log(res);
        wx.request({
          url: app.globalData.API_Base_URL + '/modle_message_collect.php',
          data: {
            formid: res.data,
            openid: openid,
            from_openid: app.globalData.openid,
            nickname: app.globalData.userInfo.nickname,
            position: app.globalData.userInfo.job,
            company: app.globalData.userInfo.company
          },
        })
      }
    })
  },
  //取消收藏名片
  cancelCollectCard: function (e) {
    add_form_id(e.detail.formId)
    var openid = e.target.dataset.openid;
    user_collect_fun.updateUserCollectDrop(openid, this.saveCallBack);
    wx.showToast({
      title: '已取消收藏',
      mask: true,
    })
  },
  //保存后处理
  saveCallBack: function (res) {
    //获取数据
    user_other_fun.getRemoteOtherUserInfo(this.data.config.openid, this.dataLoadCallback)
  },
  no_action: function (e) {
    add_form_id(e.detail.formId);
  }
})
//添加form_id
function add_form_id(form_id) {
  wx.request({
    url: app.globalData.API_Base_URL + '/formid/index/setFormId?openid=' + app.globalData.openid + '&formid=' + form_id,
  })
}